package com.excel.validators.test.basic;

import java.math.BigDecimal;
import java.util.Date;

import com.excel.validators.core.extension.annotation.DateNode;
import com.excel.validators.core.extension.annotation.DecimalNode;
import com.excel.validators.core.extension.annotation.ExcelNode;
import com.excel.validators.core.extension.annotation.FieldNode;
import com.excel.validators.core.extension.annotation.IngoreNode;

@ExcelNode(namespace="test")	// 加该注解，编译期处理，性能优。namespace不写，默认为default
public class ExcelBean {	
	
	private String username;	// excel中第一列数据
	
	@FieldNode(columnName="输出密码列名",index=3)	// 输出时列名为：输出密码列名，默认输出列名为变量名称
	private String password;	// 直接定位到第三列数据

	private char ch;			// 第四列
	
	private Integer age;		// 第五列
	
	@IngoreNode
	private String no_data;		// 忽略该字段
	
	private double money;		// 对应第六列
	
	@DecimalNode(decimal=3)		// 指定保留三位小数
	private BigDecimal more;	// 对应第七列
	
	private Date testDate;		// 第八列，日期类型，默认为 "yyyy-MM-dd HH-mm-ss
	
	@DateNode(pattern="yyyy-MM-dd")	// 日期类型，指定日期格式
	private Date birthday;		// 第九列，
	
	private long weight;		// 第十列
	
	public String getUsername() {
		return username;
	}
	
	public void setUsername(String username) {
			this.username = username;
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public char getCh() {
		return ch;
	}
	
	public void setCh(char ch) {
		this.ch = ch;
	}
	
	public String getNo_data() {
		return no_data;
	}
	
	public void setNo_data(String no_data) {
		this.no_data = no_data;
	}
	
	public Integer getAge() {
		return age;
	}
	
	public void setAge(Integer age) {
		this.age = age;
	}
	
	public double getMoney() {
		return money;
	}
	
	public void setMoney(double money) {
		this.money = money;
	}
	
	public BigDecimal getMore() {
		return more;
	}
	
	public void setMore(BigDecimal more) {
		this.more = more;
	}
	
	public Date getTestData() {
		return testDate;
	}
	
	public void setTestData(Date testDate) {
		this.testDate = testDate;
	}
	
	public Date getBirthday() {
		return birthday;
	}
	
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Long getWeight() {
		return weight;
	}
	
	public void setWeight(long weight) {
		this.weight = weight;
	}

	
	@Override
	public String toString() {
		return "ExcelBean [username=" + username + ", password=" + password + ", ch=" + ch + ", age=" + age
				+ ", no_data=" + no_data + ", money=" + money + ", more=" + more + ", testDate=" + testDate
				+ ", birthday=" + birthday + ", weight=" + weight + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((age == null) ? 0 : age.hashCode());
		result = prime * result + ((birthday == null) ? 0 : birthday.hashCode());
		result = prime * result + ch;
		long temp;
		temp = Double.doubleToLongBits(money);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + ((more == null) ? 0 : more.hashCode());
		result = prime * result + ((no_data == null) ? 0 : no_data.hashCode());
		result = prime * result + ((password == null) ? 0 : password.hashCode());
		result = prime * result + ((testDate == null) ? 0 : testDate.hashCode());
		result = prime * result + ((username == null) ? 0 : username.hashCode());
		result = prime * result + (int) (weight ^ (weight >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ExcelBean other = (ExcelBean) obj;
		if (age == null) {
			if (other.age != null)
				return false;
		} else if (!age.equals(other.age))
			return false;
		if (birthday == null) {
			if (other.birthday != null)
				return false;
		} else if (!birthday.equals(other.birthday))
			return false;
		if (ch != other.ch)
			return false;
		if (Double.doubleToLongBits(money) != Double.doubleToLongBits(other.money))
			return false;
		if (more == null) {
			if (other.more != null)
				return false;
		} else if (!more.equals(other.more))
			return false;
		if (no_data == null) {
			if (other.no_data != null)
				return false;
		} else if (!no_data.equals(other.no_data))
			return false;
		if (password == null) {
			if (other.password != null)
				return false;
		} else if (!password.equals(other.password))
			return false;
		if (testDate == null) {
			if (other.testDate != null)
				return false;
		} else if (!testDate.equals(other.testDate))
			return false;
		if (username == null) {
			if (other.username != null)
				return false;
		} else if (!username.equals(other.username))
			return false;
		if (weight != other.weight)
			return false;
		return true;
	}
}
